﻿$(function () {
    
    $('.project-type dd label input[type="checkbox"]').on('click', function () {
        if ($(this).prop('checked')) {
            $(this).parent().addClass('cur');
        } else {
            $(this).parent().removeClass('cur');
        }
    });
    $("#topFormFeedback").submit(function () {
        var Title = $("#topcompany").val();
        if (Title == "") {
            layer.msg("请输入您的公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的公司名称含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Email = $("#topemail").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("#topusername").val();
        if (SubTitle == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#topusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }


        var Descriptions = '';
$(".project-type .cur").each(function (i) {
           Descriptions+= ","+$(this).children().val();
        });
if(Descriptions == ""){
 layer.msg("请选择服务类型！", { icon: 5 });
            return false;
}else{
Descriptions=Descriptions.substring(1);
}

        
        var KeyWords = $("input[name='radotype']:checked").val()
if(KeyWords == ""||KeyWords == null){
 layer.msg("请选择预算！", { icon: 5 });
            return false;
}
        
        var VCode = $('#topvcode').val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);

        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16, 
            shade: 0.001
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 2,
                Title: Title,
                Email: Email,
                SubTitle: SubTitle,
                Phone: Phone,
                Descriptions: Descriptions,
                KeyWords: KeyWords,
                VCode: VCode,
                ClassId: 44
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);

                if (data == "success") {
                    layer.msg("您的留言已提交成功！", { icon: 1 });
                   // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();
                    $('.project-type dd label').removeClass('cur');
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })

    $(".imgval img").click(function () {
        $(this).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=contactfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
    });


    $("#contactfeedbackform").submit(function () {
        var Title = $("[name='Title']").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Tel = $("[name='Tel']").val();
        if (Tel == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Tel)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("[name='SubTitle']").val();
        if (SubTitle == "") {
            layer.msg("请输入公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("公司名称含特殊字符，请重新输入！！", { icon: 5 });
            return false;
        }

        var Email = $("[name='Email']").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        

        var Descriptions = $("[name='Descriptions']").val();
        if (Descriptions == "") {
            layer.msg("请填写内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var VCode = $("[name='VCode']").val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);
        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16,
            shade: 0.2
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 3,
                Title: Title,
                Tel: Tel,
                SubTitle: SubTitle,
                VCode: VCode,
                Email: Email,
                Descriptions: Descriptions,
                ClassId: 45
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);
                if (data == "success") {
                    layer.msg("您的留言已提交",{ icon: 1 });
                    // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();


                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })
        return false;
    })

    $("#footFormFeedback").submit(function () {
       
        var Title = $("#footusername").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#footusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var Descriptions = $("#footcontent").val();
        if (Descriptions == "") {
            layer.msg("请填写需求内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 4,
                Title: Title,
                Phone: Phone,
                Descriptions: Descriptions,
                ClassId: 46
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                if (data == "success") {
                    layer.msg("您的留言已提交", { icon: 1 });
                    var wurl = window.location.href
                    window.location.href = wurl;
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })
})

function checktopimg(obj) {
    $(obj).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=topfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
}

function CheckInput(obj) {
    var pattern = new RegExp("[`~!#$^&*()=|{}':;',\\[\\]<>/?~！#￥……&*（）——|{}【】‘；：”“'。，、？]")
    if (pattern.test(obj)) {
        return false;
    }
    return true;
}

//验证邮箱
function CheckMail(mail) {
    var filter = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/i;
    if (filter.test(mail)) { return true; }
    else { return false; }
}﻿$(function () {
    
    $('.project-type dd label input[type="checkbox"]').on('click', function () {
        if ($(this).prop('checked')) {
            $(this).parent().addClass('cur');
        } else {
            $(this).parent().removeClass('cur');
        }
    });
    $("#topFormFeedback").submit(function () {
        var Title = $("#topcompany").val();
        if (Title == "") {
            layer.msg("请输入您的公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的公司名称含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Email = $("#topemail").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("#topusername").val();
        if (SubTitle == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#topusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }


        var Descriptions = '';
$(".project-type .cur").each(function (i) {
           Descriptions+= ","+$(this).children().val();
        });
if(Descriptions == ""){
 layer.msg("请选择服务类型！", { icon: 5 });
            return false;
}else{
Descriptions=Descriptions.substring(1);
}

        
        var KeyWords = $("input[name='radotype']:checked").val()
if(KeyWords == ""||KeyWords == null){
 layer.msg("请选择预算！", { icon: 5 });
            return false;
}
        
        var VCode = $('#topvcode').val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);

        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16, 
            shade: 0.001
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 2,
                Title: Title,
                Email: Email,
                SubTitle: SubTitle,
                Phone: Phone,
                Descriptions: Descriptions,
                KeyWords: KeyWords,
                VCode: VCode,
                ClassId: 44
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);

                if (data == "success") {
                    layer.msg("您的留言已提交成功！", { icon: 1 });
                   // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();
                    $('.project-type dd label').removeClass('cur');
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })

    $(".imgval img").click(function () {
        $(this).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=contactfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
    });


    $("#contactfeedbackform").submit(function () {
        var Title = $("[name='Title']").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Tel = $("[name='Tel']").val();
        if (Tel == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Tel)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("[name='SubTitle']").val();
        if (SubTitle == "") {
            layer.msg("请输入公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("公司名称含特殊字符，请重新输入！！", { icon: 5 });
            return false;
        }

        var Email = $("[name='Email']").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        

        var Descriptions = $("[name='Descriptions']").val();
        if (Descriptions == "") {
            layer.msg("请填写内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var VCode = $("[name='VCode']").val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);
        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16,
            shade: 0.2
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 3,
                Title: Title,
                Tel: Tel,
                SubTitle: SubTitle,
                VCode: VCode,
                Email: Email,
                Descriptions: Descriptions,
                ClassId: 45
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);
                if (data == "success") {
                    layer.msg("您的留言已提交",{ icon: 1 });
                    // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();


                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })
        return false;
    })

    $("#footFormFeedback").submit(function () {
       
        var Title = $("#footusername").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#footusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var Descriptions = $("#footcontent").val();
        if (Descriptions == "") {
            layer.msg("请填写需求内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 4,
                Title: Title,
                Phone: Phone,
                Descriptions: Descriptions,
                ClassId: 46
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                if (data == "success") {
                    layer.msg("您的留言已提交", { icon: 1 });
                    var wurl = window.location.href
                    window.location.href = wurl;
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })
})

function checktopimg(obj) {
    $(obj).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=topfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
}

function CheckInput(obj) {
    var pattern = new RegExp("[`~!#$^&*()=|{}':;',\\[\\]<>/?~！#￥……&*（）——|{}【】‘；：”“'。，、？]")
    if (pattern.test(obj)) {
        return false;
    }
    return true;
}

//验证邮箱
function CheckMail(mail) {
    var filter = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/i;
    if (filter.test(mail)) { return true; }
    else { return false; }
}﻿$(function () {
    
    $('.project-type dd label input[type="checkbox"]').on('click', function () {
        if ($(this).prop('checked')) {
            $(this).parent().addClass('cur');
        } else {
            $(this).parent().removeClass('cur');
        }
    });
    $("#topFormFeedback").submit(function () {
        var Title = $("#topcompany").val();
        if (Title == "") {
            layer.msg("请输入您的公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的公司名称含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Email = $("#topemail").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("#topusername").val();
        if (SubTitle == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#topusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }


        var Descriptions = '';
$(".project-type .cur").each(function (i) {
           Descriptions+= ","+$(this).children().val();
        });
if(Descriptions == ""){
 layer.msg("请选择服务类型！", { icon: 5 });
            return false;
}else{
Descriptions=Descriptions.substring(1);
}

        
        var KeyWords = $("input[name='radotype']:checked").val()
if(KeyWords == ""||KeyWords == null){
 layer.msg("请选择预算！", { icon: 5 });
            return false;
}
        
        var VCode = $('#topvcode').val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);

        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16, 
            shade: 0.001
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 2,
                Title: Title,
                Email: Email,
                SubTitle: SubTitle,
                Phone: Phone,
                Descriptions: Descriptions,
                KeyWords: KeyWords,
                VCode: VCode,
                ClassId: 44
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);

                if (data == "success") {
                    layer.msg("您的留言已提交成功！", { icon: 1 });
                   // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();
                    $('.project-type dd label').removeClass('cur');
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })

    $(".imgval img").click(function () {
        $(this).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=contactfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
    });


    $("#contactfeedbackform").submit(function () {
        var Title = $("[name='Title']").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Tel = $("[name='Tel']").val();
        if (Tel == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Tel)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("[name='SubTitle']").val();
        if (SubTitle == "") {
            layer.msg("请输入公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("公司名称含特殊字符，请重新输入！！", { icon: 5 });
            return false;
        }

        var Email = $("[name='Email']").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        

        var Descriptions = $("[name='Descriptions']").val();
        if (Descriptions == "") {
            layer.msg("请填写内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var VCode = $("[name='VCode']").val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);
        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16,
            shade: 0.2
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 3,
                Title: Title,
                Tel: Tel,
                SubTitle: SubTitle,
                VCode: VCode,
                Email: Email,
                Descriptions: Descriptions,
                ClassId: 45
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);
                if (data == "success") {
                    layer.msg("您的留言已提交",{ icon: 1 });
                    // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();


                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })
        return false;
    })

    $("#footFormFeedback").submit(function () {
       
        var Title = $("#footusername").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#footusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var Descriptions = $("#footcontent").val();
        if (Descriptions == "") {
            layer.msg("请填写需求内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 4,
                Title: Title,
                Phone: Phone,
                Descriptions: Descriptions,
                ClassId: 46
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                if (data == "success") {
                    layer.msg("您的留言已提交", { icon: 1 });
                    var wurl = window.location.href
                    window.location.href = wurl;
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })
})

function checktopimg(obj) {
    $(obj).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=topfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
}

function CheckInput(obj) {
    var pattern = new RegExp("[`~!#$^&*()=|{}':;',\\[\\]<>/?~！#￥……&*（）——|{}【】‘；：”“'。，、？]")
    if (pattern.test(obj)) {
        return false;
    }
    return true;
}

//验证邮箱
function CheckMail(mail) {
    var filter = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/i;
    if (filter.test(mail)) { return true; }
    else { return false; }
}﻿$(function () {
    
    $('.project-type dd label input[type="checkbox"]').on('click', function () {
        if ($(this).prop('checked')) {
            $(this).parent().addClass('cur');
        } else {
            $(this).parent().removeClass('cur');
        }
    });
    $("#topFormFeedback").submit(function () {
        var Title = $("#topcompany").val();
        if (Title == "") {
            layer.msg("请输入您的公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的公司名称含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Email = $("#topemail").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("#topusername").val();
        if (SubTitle == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#topusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }


        var Descriptions = '';
$(".project-type .cur").each(function (i) {
           Descriptions+= ","+$(this).children().val();
        });
if(Descriptions == ""){
 layer.msg("请选择服务类型！", { icon: 5 });
            return false;
}else{
Descriptions=Descriptions.substring(1);
}

        
        var KeyWords = $("input[name='radotype']:checked").val()
if(KeyWords == ""||KeyWords == null){
 layer.msg("请选择预算！", { icon: 5 });
            return false;
}
        
        var VCode = $('#topvcode').val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);

        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16, 
            shade: 0.001
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 2,
                Title: Title,
                Email: Email,
                SubTitle: SubTitle,
                Phone: Phone,
                Descriptions: Descriptions,
                KeyWords: KeyWords,
                VCode: VCode,
                ClassId: 44
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);

                if (data == "success") {
                    layer.msg("您的留言已提交成功！", { icon: 1 });
                   // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();
                    $('.project-type dd label').removeClass('cur');
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })

    $(".imgval img").click(function () {
        $(this).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=contactfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
    });


    $("#contactfeedbackform").submit(function () {
        var Title = $("[name='Title']").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Tel = $("[name='Tel']").val();
        if (Tel == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Tel)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var SubTitle = $("[name='SubTitle']").val();
        if (SubTitle == "") {
            layer.msg("请输入公司名称！", { icon: 5 });
            return false;
        }
        if (!CheckInput(SubTitle)) {
            layer.msg("公司名称含特殊字符，请重新输入！！", { icon: 5 });
            return false;
        }

        var Email = $("[name='Email']").val();
        if (Email == "") {
            layer.msg("请输入您的常用邮箱！", { icon: 5 });
            return false;
        }
        if (!CheckMail(Email)) {
            layer.msg("您的常用邮箱格式错误，请重新输入！", { icon: 5 });
            return false;
        }
        

        var Descriptions = $("[name='Descriptions']").val();
        if (Descriptions == "") {
            layer.msg("请填写内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var VCode = $("[name='VCode']").val();
        if (VCode == "") {
            layer.msg("请输入验证码！", { icon: 5 });
            return false;
        }
        if (!CheckInput(VCode)) {
            layer.msg("验证码含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var _this = $(this);
        // loading
        var loading = layer.msg('正在提交中...', {
            icon: 16,
            shade: 0.2
        });
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 3,
                Title: Title,
                Tel: Tel,
                SubTitle: SubTitle,
                VCode: VCode,
                Email: Email,
                Descriptions: Descriptions,
                ClassId: 45
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                layer.close(loading);
                if (data == "success") {
                    layer.msg("您的留言已提交",{ icon: 1 });
                    // var wurl = window.location.href
                    // window.location.href = wurl;
                    _this[0].reset();


                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })
        return false;
    })

    $("#footFormFeedback").submit(function () {
       
        var Title = $("#footusername").val();
        if (Title == "") {
            layer.msg("请输入您的姓名！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Title)) {
            layer.msg("您的姓名含特殊字符，请重新填写！", { icon: 5 });
            return false;
        }
        var Phone = $("#footusertel").val();
        if (Phone == "") {
            layer.msg("请输入您的联系电话！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Phone)) {
            layer.msg("您的联系电话含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        var Descriptions = $("#footcontent").val();
        if (Descriptions == "") {
            layer.msg("请填写需求内容！", { icon: 5 });
            return false;
        }
        if (!CheckInput(Descriptions)) {
            layer.msg("内容含特殊字符，请重新输入！", { icon: 5 });
            return false;
        }
        $.ajax({
            type: "Post",
            url: "/ashx/ajax.ashx",
            data: {
                op: 4,
                Title: Title,
                Phone: Phone,
                Descriptions: Descriptions,
                ClassId: 46
            },
            cache: false,
            async: false,
            dataType: "html",
            success: function (data) {
                if (data == "success") {
                    layer.msg("您的留言已提交", { icon: 1 });
                    var wurl = window.location.href
                    window.location.href = wurl;
                } else if (data == "vcode error") {
                    layer.msg("验证码错误，请重新输入！", { icon: 5 });
                }
                else {
                    layer.msg("非常抱歉，您的信息提交失败！", { icon: 5 });
                }
            }
        })

        return false;
    })
})

function checktopimg(obj) {
    $(obj).attr("src", "/ashx/CheckCode.ashx?bgcolor=dde3ec&name=topfeedbackadd&color=gray&size=18&offset=6&" + Math.random());
}

function CheckInput(obj) {
    var pattern = new RegExp("[`~!#$^&*()=|{}':;',\\[\\]<>/?~！#￥……&*（）——|{}【】‘；：”“'。，、？]")
    if (pattern.test(obj)) {
        return false;
    }
    return true;
}

//验证邮箱
function CheckMail(mail) {
    var filter = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/i;
    if (filter.test(mail)) { return true; }
    else { return false; }
}